@file:Suppress("unused")

package top.techqi.core.kext

import android.util.SparseArray
import android.util.SparseBooleanArray
import android.util.SparseIntArray
import android.util.SparseLongArray

fun <T> SparseArray<T>.poll(key: Int): T? {
    val value = get(key)
    delete(key)
    return value
}

fun SparseBooleanArray.poll(key: Int): Boolean {
    val value = get(key)
    delete(key)
    return value
}

fun SparseIntArray.poll(key: Int): Int {
    val value = get(key)
    delete(key)
    return value
}

fun SparseLongArray.poll(key: Int): Long {
    val value = get(key)
    delete(key)
    return value
}
